$('button').click(function(){
    setLogin()
   })


   async function setLogin(){
    let name = $('.nameIpt').val();
    let pwd = $('.pwdIpt').val();

    let res = await myPromiseAjax('../server/goods_login.php' , 'post' , {userName:name,userPwd:pwd} , 'json');
    if(res.code === 1){
        let num = 5;

        $('[name="result"]').html(`<span>恭喜你登录成功，还有${num}秒返回来时页面，<a href="./index.html" style="color:blue">点击跳转首页</a></span>`);
        let t = setInterval(() => {
            num--;

            $('[name="result"]').html(`<span>恭喜你登录成功，还有${num}秒返回来时页面，<a href="./index.html" style="color:blue">点击跳转首页</a></span>`);

            if(num === 1){

            clearInterval( t );

            window.history.back();

            }

        }, 1000);
      mySetCookie( 'login' , 1 , 7*24*60*60 , '/' );
    } else if(res.code === 0){

    window.alert('对不起,账号或密码不存在,登录失败,请您重新登录');

    }
   }